<%--
  Created by IntelliJ IDEA.
  User: wangxiaoping
  Date: 2024/8/24
  Time: 18:12
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    pageContext.setAttribute("username1","秦疆1号");
    request.setAttribute("username2","秦疆2号");
    session.setAttribute("username3","秦疆3号");
    application.setAttribute("username4","秦疆4号");
%>

<%
    String username1 = (String)pageContext.getAttribute("username1");
    String username2 = (String)pageContext.getAttribute("username2");
    String username3 = (String)pageContext.getAttribute("username3");
    String username4 = (String)pageContext.getAttribute("username4");
    String username5 = (String)pageContext.getAttribute("username5");
    request.getRequestDispatcher("pagedemo.jsp").forward(request,response);
%>

<h1>取出的值为：</h1>
<h3>${username1}</h3>
<h3>${username2}</h3>
<h3>${username3}</h3>
<h3>${username4}</h3>
<%--<h3>${username5}</h3>--%>
<h3><%=username5%></h3> <%--会在页面上显示null--%>
</body>
</html>
